const {Article} = require('../../model/article');
const pagination = require('mongoose-sex-page');
module.exports = async (req, res)=>{
    const page = req.query.page;
    const articles = await pagination(Article).page(page).size(2).display(5).find().populate('author').exec();
    let result = JSON.stringify(articles);
    result = JSON.parse(result);
    res.render('home/default.art',{
        articles : result
    });
};
